// console.log("function",_temp,"this",E,"args",x,"ret",B[B.length - 1]),false
// console.log("取余",B[B.length - 2],"%",B[B.length - 1],"ret", B[B.length - 2] % B[B.length - 1]),false
// typeof B[B.length - 2] == "string" ? console.log("参数输出", B[B.length - 2]) : false, false
// window._log = ''
// window._log +=JSON.stringify(B, function(key, value) {if (value == window) {return 'window'} return value}), false
// 触发点：window.TDC.getData(!0)


function longNumToCode(longNum) {
    let a1 = longNum & 0xff
    let a2 = (longNum >> 8) & 0xff
    let a3 = (longNum >> 16) & 0xff
    let a4 = (longNum >> 24) & 0xff

    return String.fromCharCode.apply(String, [a1, a2, a3, a4])
}

// let arr1 = longNumToCode(11909181765)
// console.log(arr1)

// console.log(String.fromCharCode.apply(String, arr1))


function strToLongNum(str) {
    let ret = 0;
    for (let i = 0; i < str.length; i++) {
        // let a = str.charCodeAt(i);
        // let b = 8 * i;
        // let c = a << b;
        // let d = ret | c;
        // ret = d;
        ret = ret | (str.charCodeAt(i) << 8 * i)
    }
    return ret
}

// console.log(strToLongNum('"sd"'));
// console.log(strToLongNum(':{"o'));

function longNumToNum(num1, num2) {
    let key = [1181371245, 1665611081 + 1118476, 1667515450 + 592139, 1799705192]
    let sum = 0;
    for (let i = 0; i < 32; i++) {
        num1 += (num2 + ((num2 << 4) ^ (num2 >>> 5))) ^ (sum + key[sum & 3]);
        sum += 2654435769;
        num2 += (num1 + ((num1 << 4) ^ (num1 >>> 5))) ^ (sum + key[(sum >>> 11) & 3]);
    }
    return [num1, num2];
}
// console.log(longNumToNum(577008418, 1864530746))


function main(str) {
    let result = ""
    // 填充字符串为8的倍数
    if(str.indexOf('"sd":{"od":"C"') !=-1){
        str = str.padEnd(Math.ceil(str.length / 24) * 24, ' ')
    }
    

    for (let i = 0; i < str.length; i += 8) {
        let num1 = strToLongNum(str.substring(i, i + 4));
        let num2 = strToLongNum(str.substring(i + 4, i + 8));
        let longNum = longNumToNum(num1, num2);
        result += longNumToCode(longNum[0]) + longNumToCode(longNum[1]);
    }
    return result
}

let str1 = '{"cd":[1067,"ANGLE (Intel, Intel(R) Iris(R) Xe Graphics Direct3D11 vs_5_0 ps_5_0, D3D11)",0,"","",1707,0,"GgoAAAANSUhEUgAAASwAAACWCAYAAAG4zg9PFnZcfeEVfxorjqQo66B2geI//AAJ8P9Hrw4gAAAABJRU5ErkJggg==",2,629,2,"",20,643,"UTF-8",1736841431,"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36",[1707,325],"+08",'
let str2 = '[[3,-1,-1,1736841324615,0]]';
let str3 = ',"https://ssl.captcha.qq.com/template/pc_qq_captcha.html?rand=1519713624347",706882856,"Google Inc. (Intel)","98k",1,"1707-1067-1019-24-*-*-|-*",24,0,"unknown",0,336484159,1736840428,"top",null,"Win32",["zh-CN","zh"],1736841188,1023],';
let str4 = '"sd":{"od":"C"}}';

console.log("1", btoa(main(str1)))
console.log("2", btoa(main(str2)))
console.log("3", btoa(main(str3)))
console.log("4", btoa(main(str4)))
// let res = btoa(main(str1)) + btoa(main(str2)) + btoa(main(str3)) + btoa(main(str4))
// W+DqaKl9B4Q8BvK2JKnwK1F8xm6i5lBc1W2NbRLn7ssyMeq1FEui5EJcca71718G1cyPVeWKVLNsNsvsLc3Z892n5Cj2Y2HC3VMcdvFLItwPo7RvBrmtTJcPviND3X3jsi047BucAkjY3tz36ibrbXrBJiiLTKQ2CZc0WTE0Y3EelfbYZLNN3A3iFOO2SuNh3yGKghSozPJG69aF1ViNyyhiEo5j8YZG5LJUWjBf0a6po6D0VMrMj0S+CF6aqtM6a1f9INvCFSOVj3URHQDNMONR/RuahxslNbqyuM7WhIVBGHzoHJ2snEoggHHADyZotAzGKZe0H1Lkyv/oeKAeo59BlqeMtbikiUltkdOg1e3IWVAUAAsmY8P4GtHS2q6fXAv5Co41VA4h62OceJ3hhm43ihdNX4HgiDvFCGNYw2zU5RyQgS0Gh764ih9RfDYUW4c6AyK25M4wl4/xk3C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Fywm7T25Sey3+mn9LnS8T4S42vRP2JkTxNPlN3AEdXT61YJiMbytcfg7gdUEvuLRls5sxEmF2KJugYnJc3WDcobUCkPPUsOITAp2riFAZ3TftTO4hG1T833UFFy+JZP6NSErJTvQqS6W4zIkrrfVIBnT6BVTChJH/zdvV9yc+ydSLRzbCQKKKY9EPEKGO0ZBWljfJ+ruucDaczWyViKvJbDi+RbHXxX4lAuRtQehRgOwKuhG0IsdHFj5M
//  console.log(res);

// window.getData(!0)手动触发


// 577008418  1864530746
function longNumToNum2(num1, num2) {
    let arr = [1181371245, 1665611081 + 1118476 + 2654435769, 1667515450 + 592139 + 5308871538, 2654435769 + 1799705192]
    let sum = 0;

    let a1 = num2 << 4; // -232279136
    let a2 = num2 >>> 5; // 58266585
    let a3 = a1 ^ a2; // -245456775
    let a4 = num2 + a3; // 1619073971
    let a5 = sum & 3; // 0
    // let a6 = 0 + 1181371245;// 1181371245
    let a6 = sum + arr[a5];
    let a7 = a4 ^ a6; // 652955870
    num1 = num1 + a7; // 1229964288
    sum = sum + 2654435769;// 2654435769


    let b1 = num1 << 4;// -1795407872
    let b2 = num1 >>> 5; //38436384
    let b3 = b1 ^ b2; // -1766441440
    let b4 = num1 + b3; // -536477152
    let b5 = sum >>> 11; // 1296111
    let b6 = b5 & 3; // 3
    // let b7 = 2654435769 + 1799705192;// 4454140961
    let b7 = arr[b6];
    let b8 = b4 ^ b7; // -377827839
    num2 = num2 + b8; // 1486702907


    let c1 = num2 << 4; // -1982557264
    let c2 = num2 >>> 5; // 46459465
    let c3 = c1 ^ c2;// -1961854471
    let c4 = num2 + c3; // -475151564
    let c5 = 2654435769 & 3;// 1
    // let c6 = 1665611081 + 1118476; // 1666729557;
    // let c6_1 = 2654435769 + c6;// 4321165326
    let c6_1 = arr[c5];
    let c8 = c4 ^ c6_1;// -501087430
    num1 = num1 + c8; // 728876858
    sum = sum + 2654435769;// 5308871538

    let d1 = num1 << 4; // -1222872160
    let d2 = num1 >>> 5; // 22777401
    let d3 = d1 ^ d2; // -1236796007
    let d4 = num1 + d3; // -507919149
    let d5 = c9 >>> 11; // 495070
    let d6 = d5 & 3; // 2
    // let d7 = 1667515450 + 592139; // 1668107589
    // let d7_1 = 5308871538 + d7; // 6976979127
    let d7_1 = arr[d6];
    let d8 = d4 ^ d7_1; // 2120582244
    num2 = num2 + d8; // 3607285151


}
